<?php

use think\facade\Route;

Route::group('user', function () {

    // 短信注册
    Route::post('user/smsRegister', 'api.user.User/smsRegister');
    // 账号登录
    Route::post('user/accountLogin', 'api.user.User/accountLogin');
    // 短信登陆
    Route::post('user/smsLogin', 'api.user.User/smsLogin');
    // 重置密码
    Route::post('user/resetPassword', 'api.user.User/resetPassword');


    // 需登陆
    Route::group(function () {
        // 个人信息
        Route::get('user/profile', 'api.user.User/profile');
        // 用户数据
        Route::get('user/data', 'api.user.User/data');
        // 更改密码
        Route::post('user/changePassword', 'api.user.User/changePassword');
        // 绑定手机号
        Route::post('user/changeMobile', 'api.user.User/changeMobile');
        // 更换用户名
        Route::post('user/changeUsername', 'api.user.User/changeUsername');
        // 第三方信息
        Route::get('user/thirdOauth', 'api.user.User/thirdOauth');
        // 登出
        Route::post('user/logout', 'api.user.User/logout');

        // 获取提现账户信息
        Route::get('account', 'api.user.Account/index');
        // 编辑提现账户信息
        Route::post('account', 'api.user.Account/save');
        Route::get('goodsLog/:type', 'api.user.GoodsLog/list')->name('api.user.GoodsLog.list');
        // 收藏,浏览记录
        Route::get('goodsLog/:type', 'api.user.GoodsLog/list')->name('api.user.GoodsLog.list');
        // 收藏
        Route::post('goodsLog/favorite', 'api.user.GoodsLog/favorite')->name('api.user.userGoodsLog.favorite');
        Route::delete('goodsLog/viewDel', 'api.user.GoodsLog/viewDel')->name('api.user.userGoodsLog.viewDel');

        // 我的优惠券
        Route::resource('coupon', 'api.user.Coupon');

        // 默认收货地址
        Route::get('address/default', 'api.user.Address/default')->name('api.user.address.default');
        // 我的收货地址
        Route::resource('address', 'api.user.Address');

        // 我的发票
        Route::resource('invoice', 'api.user.Invoice');
    })->middleware('check_login', 'user');
});
